﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccessLayer.DAL;
using DataAccessLayer;
using Common;
namespace BestBuy.AdminViews
{
    public partial class AddRegulationst : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            User user = UserDAL.GetUserByUsername(HttpContext.Current.User.Identity.Name);
            if (user == null || user.RoleID != (int)RoleType.Admin)
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            if (!Page.IsPostBack)
            {
            }

        }

        protected void AddRegulationstInfoButton_Click1(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }
            DataAccessLayer.Configuration config = new DataAccessLayer.Configuration()
            {
                Name = Name.Text.Trim(),
                Detail = Detail.Text.Trim(),
            };
            ConfigurationDAL.SaveConfigurationDAL(config);
            AdminInfoMessage.Show("Success add regulations.", UserControls.MessagePanel.MessageType.Success);
        }
    }
}